//
//  HJDataPacketHeader.h
//  Q24141
//
//  Created by lx on 2023/10/16.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

//这个类是根据body自动生成headerData的, 还有根据服务端返回的data, 自动解析出header


typedef NS_ENUM(NSInteger, HJDataPacketOperation) {
    HJDataPacketOperationHeartbeat = 2,
    HJDataPacketOperationReplyHeartbeat = 3,
    HJDataPacketOperationAuthorization = 7,
    HJDataPacketOperationReplyAuthorization = 8,
    HJDataPacketOperationSingleMessage = 9,
    HJDataPacketOperationComfirmMessage = 20,
    HJDataPacketOperationReplyComfirmMessage = 21,
    HJDataPacketOperationGroupMessage = 100,
    HJDataPacketOperationRetryMessage = 1000,
};

@interface HJDataPacketHeader : NSObject

- (HJDataPacketHeader * _Nullable )initWithHeaderData:(NSData *)headerData;
- (HJDataPacketHeader *)initWithBodyData:(nullable NSData *)bodyData seq:(int)seq operation:(int)operation;

@property (nonatomic, strong, readonly) NSData *data;//头部data
@property (nonatomic, assign, readonly) uint32_t packageLenght;
@property (nonatomic, assign, readonly) uint16_t headerLenght;
@property (nonatomic, assign, readonly) uint16_t protocolVersion;
@property (nonatomic, assign, readonly) uint32_t operation;
@property (nonatomic, assign, readonly) uint32_t seqId;


@end

NS_ASSUME_NONNULL_END
